Reverse Proxy incorrectly transform content

Reverse Proxy incorrectly transform content

am 08.02.2010 11:50:37 von Pongtawat Chippimolchai

--00151757470054ee0d047f149216
Content-Type: text/plain; charset=ISO-8859-1

Hello,

I'm using Apache to redirect request via reverse proxy to Tomcat on port
8080. On most of the pages, it will work flawlessly. However, on some pages,
it seems that Apache will incorrectly modify the HTML content (IMO, as part
of URL transformation). For example the following code:

href="/Blog/CategoryRss?xpage=plain&category=Blog.News" title="RSS">

becomes:

class="wikimodel-freestanding" href="
http://wiki.knowledgesharing.in.th/Blog/CategoryRss?xpage=pl ain&category=Blog.News"> class="wikigeneratedlinkcontent">
http://wiki.knowledgesharing.in.th/Blog/CategoryRss?xpage=pl ain&category=Blog.News
"
title="RSS">

with a mysterious span code inside href attribute.

FYI, the original HTML validated as XHTML 1.0 Strict.

I have no idea what cause this. Please help.

My setting is as follow.

Apache version:
I have this issue with Apache on both Ubuntu 8.04 and 9.10, i.e. the
following versions:

Server version: Apache/2.2.8 (Ubuntu)
Server built: Nov 13 2009 21:58:02

Server version: Apache/2.2.12 (Ubuntu)
Server built: Nov 12 2009 22:51:51

The reverse proxy is configured as follow:


ServerName wiki.knowledgesharing.in.th
ServerAdmin "admin AT knowledgesharing DOT in DOT th"
ServerSignature Email

ProxyPass / http://wiki.knowledgesharing.in.th:8080/
ProxyPassReverse / http://wiki.knowledgesharing.in.th:8080/


Options FollowSymLinks
AllowOverride None



The site is live, so you could try it at:

http://wiki.knowledgesharing.in.th/Blog/ (via Apache reverse proxy)
http://wiki.knowledgesharing.in.th:8080/Blog/ (direct to Tomcat, without
reverse proxy)

Thank you very much,
Pongtawat

--00151757470054ee0d047f149216
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello,


I'm using Apache to redirect request via reve=
rse proxy to Tomcat on port 8080. On most of the pages, it will work flawle=
ssly. However, on some pages, it seems that Apache will incorrectly modify =
the HTML content (IMO, as part of URL transformation). For example the foll=
owing code:


<span class=3D"blog-category-level"><=
;a href=3D" /Blog/CategoryRss?xpage=3Dplain&amp;category=3DBlog.New=
s" title=3D"RSS">

becomes:
=


<span class=3D"blog-category-level"><a href=
=3D"<span class=3D"wikiexternallink"><a class=3D&qu=
ot;wikimodel-freestanding" href=3D" gesharing.in.th/Blog/CategoryRss?xpage=3Dplain&amp;amp;c ategory=3DBlog.=
News">http://wiki.knowledgesharing.in.th/Blog/CategoryRss?xp age=3Dplain&=
;amp;amp;category=3DBlog.News
"><span class=3D"wikigener=
atedlinkcontent"> /CategoryRss?xpage=3Dplain&amp;amp;category=3DBlog.News" >http://wiki.kn=
owledgesharing.in.th/Blog/CategoryRss?xpage=3Dplain&amp; amp;category=3D=
Blog.News
</span></a></span>" title=3D"RSS&q=
uot;>


with a mysterious span code inside href attribute. >

FYI, the original HTML validated as XHTML 1.0 Strict.<=
/div>

I have no idea what cause this. Please help.


My setting is as follow.

Apach=
e version:=A0
I have this issue with Apache on both Ubuntu 8.04 a=
nd 9.10, i.e. the following versions:

Server =
version: Apache/2.2.8 (Ubuntu)

Server built: =A0 Nov 13 2009 21:58:02

S=
erver version: Apache/2.2.12 (Ubuntu)
Server built: =A0 Nov 12 20=
09 22:51:51

The reverse proxy is configured =
as follow:


<VirtualHost *:80>
Apple-tab-span" style=3D"white-space:pre"> ServerName p://wiki.knowledgesharing.in.th">wiki.knowledgesharing.in.th
=
ServerAdmi=
n "admin AT knowledgesharing DOT in DOT th"

Serve=
rSignature Email



=3D"Apple-tab-span" style=3D"white-space:pre"> <Directory /> div>
Opti=
ons FollowSymLinks
space:pre"> AllowOverride None
pan" style=3D"white-space:pre"> </Directory>

</VirtualHost>

The site is live, so you=
could try it at:


http://wiki.=
knowledgesharing.in.th:8080/Blog/
(direct to Tomcat, without reverse pr=
oxy)

Thank you very much,
Pongtawat >


--00151757470054ee0d047f149216--

Re: Reverse Proxy incorrectly transform content

am 08.02.2010 12:35:17 von Tom Evans

On Mon, Feb 8, 2010 at 10:50 AM, Pongtawat Chippimolchai
wrote:
> Hello,
> I'm using Apache to redirect request via reverse proxy to Tomcat on port
> 8080. On most of the pages, it will work flawlessly. However, on some pag=
es,
> it seems that Apache will incorrectly modify the HTML content (IMO, as pa=
rt
> of URL transformation). For example the following code:
> > href=3D"/Blog/CategoryRss?xpage=3Dplain&category=3DBlog. News" title=
=3D"RSS">
> becomes:
> llink"> > class=3D"wikimodel-freestanding"
> href=3D"http://wiki.knowledgesharing.in.th/Blog/CategoryRss? xpage=3Dplain=
&amp;category=3DBlog.News"> > class=3D"wikigeneratedlinkcontent">http://wiki.knowledgeshar ing.in.th/Blo=
g/CategoryRss?xpage=3Dplain&amp;category=3DBlog.News
"
> title=3D"RSS">
> with a mysterious span code inside href attribute.
> FYI, the original HTML validated as XHTML 1.0 Strict.
> I have no idea what cause this. Please help.
> My setting is as follow.
> Apache version:
> I have this issue with Apache on both Ubuntu 8.04 and 9.10, i.e. the
> following versions:
> Server version: Apache/2.2.8 (Ubuntu)
> Server built:   Nov 13 2009 21:58:02
> Server version: Apache/2.2.12 (Ubuntu)
> Server built:   Nov 12 2009 22:51:51
> The reverse proxy is configured as follow:
>
> ServerName wiki.knowledgesharing.in.th
> ServerAdmin "admin AT knowledgesharing DOT in DOT th"
> ServerSignature Email
> ProxyPass / http://wiki.knowledgesharing.in.th:8080/
> ProxyPassReverse / http://wiki.knowledgesharing.in.th:8080/
>
> Options FollowSymLinks
> AllowOverride None
>

>

> The site is live, so you could try it at:
> http://wiki.knowledgesharing.in.th/Blog/ (via Apache reverse proxy)
> http://wiki.knowledgesharing.in.th:8080/Blog/ (direct to Tomcat, without
> reverse proxy)
> Thank you very much,
> Pongtawat

ProxyPass and ProxyPassReverse do not modify the HTML content of the
page. From the docs of ProxyPassReverse:

Only the HTTP response headers specifically mentioned above will be
rewritten. Apache will not rewrite other response headers, nor will it
rewrite URL references inside HTML pages. This means that if the
proxied content contains absolute URL references, they will by-pass
the proxy. A third-party module that will look inside the HTML and
rewrite URL references is Nick Kew's mod_proxy_html.

Cheers

Tom

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: Reverse Proxy incorrectly transform content

am 09.02.2010 05:20:09 von Pongtawat Chippimolchai

--001636834258b4db35047f233bef
Content-Type: text/plain; charset=ISO-8859-1

Dear Tom,

Thank you very much for clarifying this. That explains why it work correctly
if I save the page as HTML and let Tomcat serve it statically behind Apache
reverse proxy. So, there must be something wrong with XWiki apps when
working behind Apache. I have checked the request that was send to Tomcat
and it seems ok. So, it might be something in the header or environment?

Thank you,
Pongtawat

On Mon, Feb 8, 2010 at 6:35 PM, Tom Evans wrote:

> On Mon, Feb 8, 2010 at 10:50 AM, Pongtawat Chippimolchai
> wrote:
> > Hello,
> > I'm using Apache to redirect request via reverse proxy to Tomcat on port
> > 8080. On most of the pages, it will work flawlessly. However, on some
> pages,
> > it seems that Apache will incorrectly modify the HTML content (IMO, as
> part
> > of URL transformation). For example the following code:
> > > > href="/Blog/CategoryRss?xpage=plain&category=Blog.News" title="RSS">
> > becomes:
> > > > class="wikimodel-freestanding"
> > href="
> http://wiki.knowledgesharing.in.th/Blog/CategoryRss?xpage=pl ain&amp;category=Blog.News
> "> > > class="wikigeneratedlinkcontent">
> http://wiki.knowledgesharing.in.th/Blog/CategoryRss?xpage=pl ain&amp;category=Blog.News
>
"
> > title="RSS">
> > with a mysterious span code inside href attribute.
> > FYI, the original HTML validated as XHTML 1.0 Strict.
> > I have no idea what cause this. Please help.
> > My setting is as follow.
> > Apache version:
> > I have this issue with Apache on both Ubuntu 8.04 and 9.10, i.e. the
> > following versions:
> > Server version: Apache/2.2.8 (Ubuntu)
> > Server built: Nov 13 2009 21:58:02
> > Server version: Apache/2.2.12 (Ubuntu)
> > Server built: Nov 12 2009 22:51:51
> > The reverse proxy is configured as follow:
> >
> > ServerName wiki.knowledgesharing.in.th
> > ServerAdmin "admin AT knowledgesharing DOT in DOT th"
> > ServerSignature Email
> > ProxyPass / http://wiki.knowledgesharing.in.th:8080/
> > ProxyPassReverse / http://wiki.knowledgesharing.in.th:8080/
> >
> > Options FollowSymLinks
> > AllowOverride None
> >

> >

> > The site is live, so you could try it at:
> > http://wiki.knowledgesharing.in.th/Blog/ (via Apache reverse proxy)
> > http://wiki.knowledgesharing.in.th:8080/Blog/ (direct to Tomcat, without
> > reverse proxy)
> > Thank you very much,
> > Pongtawat
>
> ProxyPass and ProxyPassReverse do not modify the HTML content of the
> page. From the docs of ProxyPassReverse:
>
> Only the HTTP response headers specifically mentioned above will be
> rewritten. Apache will not rewrite other response headers, nor will it
> rewrite URL references inside HTML pages. This means that if the
> proxied content contains absolute URL references, they will by-pass
> the proxy. A third-party module that will look inside the HTML and
> rewrite URL references is Nick Kew's mod_proxy_html.
>
> Cheers
>
> Tom
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

--001636834258b4db35047f233bef
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Dear Tom,


Thank you very much for clarifying this. That =
explains why it work correctly if I save the page as HTML and let Tomcat se=
rve it statically behind Apache reverse proxy. So, there must be something =
wrong with XWiki apps when working behind Apache. I have checked the reques=
t that was send to Tomcat and it seems ok. So, it might be something in the=
header or environment?


Thank you,
Pongtawat

il_quote">On Mon, Feb 8, 2010 at 6:35 PM, Tom Evans <<=
a href=3D"http://tevans.uk">tevans.uk@ >googlemail.com>
wrote:

x #ccc solid;padding-left:1ex;">
On Mon, F=
eb 8, 2010 at 10:50 AM, Pongtawat Chippimolchai

<&=
gt; wrote:

> Hello,

> I'm using Apache to redirect request via reverse proxy to Tomcat o=
n port

> 8080. On most of the pages, it will work flawlessly. However, on some =
pages,

> it seems that Apache will incorrectly modify the HTML content (IMO, as=
part

> of URL transformation). For example the following code:

> <span class=3D"blog-category-level"><a

> href=3D"/Blog/CategoryRss?xpage=3Dplain&amp;category=3DBlog.N=
ews" title=3D"RSS">

> becomes:

> <span class=3D"blog-category-level"><a href=3D"=
;<span class=3D"wikiexternallink"><a

> class=3D"wikimodel-freestanding"

> href=3D" ryRss?xpage=3Dplain&amp;amp;category=3DBlog.News" target=3D"_blank">htt=
p://wiki.knowledgesharing.in.th/Blog/CategoryRss?xpage=3Dpla in&amp;amp;=
category=3DBlog.News
"><span


> class=3D"wikigeneratedlinkcontent"> ..knowledgesharing.in.th/Blog/CategoryRss?xpage=3Dplain& amp;amp;category=
=3DBlog.News" target=3D"_blank">http://wiki.knowledgesharing.in.th/Blog/Ca t=
egoryRss?xpage=3Dplain&amp;amp;category=3DBlog.News
</span><=
;/a></span>"


> title=3D"RSS">

> with a mysterious span code inside href attribute.

> FYI, the original HTML validated as XHTML 1.0 Strict.

> I have no idea what cause this. Please help.

> My setting is as follow.

> Apache version:

> I have this issue with Apache on both Ubuntu 8.04 and 9.10, i.e. the r>
> following versions:

> Server version: Apache/2.2.8 (Ubuntu)

> Server built: =A0 Nov 13 2009 21:58:02

> Server version: Apache/2.2.12 (Ubuntu)

> Server built: =A0 Nov 12 2009 22:51:51

> The reverse proxy is configured as follow:

> <VirtualHost *:80>

> ServerName lank">wiki.knowledgesharing.in.th

> ServerAdmin "admin AT knowledgesharing DOT in DOT th"

> ServerSignature Email

> ProxyPass / t=3D"_blank">http://wiki.knowledgesharing.in.th:8080/

> ProxyPassReverse / " target=3D"_blank">http://wiki.knowledgesharing.in.th:8080/

> <Directory />

> Options FollowSymLinks

> AllowOverride None

> </Directory>

> </VirtualHost>

> The site is live, so you could try it at:

> >http://wiki.knowledgesharing.in.th/Blog/ (via Apache reverse proxy) >
> lank">http://wiki.knowledgesharing.in.th:8080/Blog/ (direct to Tomcat, =
without

> reverse proxy)

> Thank you very much,

> Pongtawat



ProxyPass and ProxyPassReverse do not modify the HTML content o=
f the

page. From the docs of ProxyPassReverse:



Only the HTTP response headers specifically mentioned above will be

rewritten. Apache will not rewrite other response headers, nor will it

rewrite URL references inside HTML pages. This means that if the

proxied content contains absolute URL references, they will by-pass

the proxy. A third-party module that will look inside the HTML and

rewrite URL references is Nick Kew's mod_proxy_html.



Cheers



Tom



------------------------------------------------------------ ---------

The official User-To-User support forum of the Apache HTTP Server Project.<=
br>
See <URL: lank">http://httpd.apache.org/userslist.html> for more info.

To unsubscribe, e-mail: g">users-unsubscribe@httpd.apache.org

=A0 " =A0 from the digest: @httpd.apache.org">users-digest-unsubscribe@httpd.apache.org

For additional commands, e-mail: org">users-help@httpd.apache.org






--001636834258b4db35047f233bef--

Re: Reverse Proxy incorrectly transform content

am 10.02.2010 22:47:47 von Devraj Mukherjee

Hi Pongtawat,

We have worked on a similar issue with the Pentaho business
intelligence suite. If you are using Apache 2.2 + You can use
mob_substitute and have rules that change the domain name and fix
these issues.

I believe these issues are caused by dynamically generated URLs via
JavaScript etc.

Happy to share my configuration. Hope this helps.

On Tue, Feb 9, 2010 at 3:20 PM, Pongtawat Chippimolchai
wrote:
> Dear Tom,
> Thank you very much for clarifying this. That explains why it work correc=
tly
> if I save the page as HTML and let Tomcat serve it statically behind Apac=
he
> reverse proxy. So, there must be something wrong with XWiki apps when
> working behind Apache. I have checked the request that was send to Tomcat
> and it seems ok. So, it might be something in the header or environment?
> Thank you,
> Pongtawat
>
> On Mon, Feb 8, 2010 at 6:35 PM, Tom Evans wrot=
e:
>>
>> On Mon, Feb 8, 2010 at 10:50 AM, Pongtawat Chippimolchai
>> wrote:
>> > Hello,
>> > I'm using Apache to redirect request via reverse proxy to Tomcat on po=
rt
>> > 8080. On most of the pages, it will work flawlessly. However, on some
>> > pages,
>> > it seems that Apache will incorrectly modify the HTML content (IMO, as
>> > part
>> > of URL transformation). For example the following code:
>> > >> > href=3D"/Blog/CategoryRss?xpage=3Dplain&category=3DBlog. News" titl=
e=3D"RSS">
>> > becomes:
>> > >> > class=3D"wikiexternallink"> >> > class=3D"wikimodel-freestanding"
>> >
>> > href=3D"http://wiki.knowledgesharing.in.th/Blog/CategoryRss? xpage=3Dpl=
ain&amp;category=3DBlog.News"> >> >
>> > class=3D"wikigeneratedlinkcontent">http://wiki.knowledgeshar ing.in.th/=
Blog/CategoryRss?xpage=3Dplain&amp;category=3DBlog.News
n>"
>> > title=3D"RSS">
>> > with a mysterious span code inside href attribute.
>> > FYI, the original HTML validated as XHTML 1.0 Strict.
>> > I have no idea what cause this. Please help.
>> > My setting is as follow.
>> > Apache version:
>> > I have this issue with Apache on both Ubuntu 8.04 and 9.10, i.e. the
>> > following versions:
>> > Server version: Apache/2.2.8 (Ubuntu)
>> > Server built: =A0 Nov 13 2009 21:58:02
>> > Server version: Apache/2.2.12 (Ubuntu)
>> > Server built: =A0 Nov 12 2009 22:51:51
>> > The reverse proxy is configured as follow:
>> >
>> > ServerName wiki.knowledgesharing.in.th
>> > ServerAdmin "admin AT knowledgesharing DOT in DOT th"
>> > ServerSignature Email
>> > ProxyPass / http://wiki.knowledgesharing.in.th:8080/
>> > ProxyPassReverse / http://wiki.knowledgesharing.in.th:8080/
>> >
>> > Options FollowSymLinks
>> > AllowOverride None
>> >

>> >

>> > The site is live, so you could try it at:
>> > http://wiki.knowledgesharing.in.th/Blog/ (via Apache reverse proxy)
>> > http://wiki.knowledgesharing.in.th:8080/Blog/ (direct to Tomcat, witho=
ut
>> > reverse proxy)
>> > Thank you very much,
>> > Pongtawat
>>
>> ProxyPass and ProxyPassReverse do not modify the HTML content of the
>> page. From the docs of ProxyPassReverse:
>>
>> Only the HTTP response headers specifically mentioned above will be
>> rewritten. Apache will not rewrite other response headers, nor will it
>> rewrite URL references inside HTML pages. This means that if the
>> proxied content contains absolute URL references, they will by-pass
>> the proxy. A third-party module that will look inside the HTML and
>> rewrite URL references is Nick Kew's mod_proxy_html.
>>
>> Cheers
>>
>> Tom
>>
>> ------------------------------------------------------------ ---------
>> The official User-To-User support forum of the Apache HTTP Server Projec=
t.
>> See for more info.
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> =A0 " =A0 from the digest: users-digest-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>
>



--=20
Follow me on Twitter, http://twitter.com/mdevraj

"The secret impresses no-one, the trick you use it for is everything"
- Alfred Borden (The Prestiege)

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org